﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MovementList.aspx.cs" EnableEventValidation="false"
    Inherits="WMS6.Web.Inventory.MovementList" meta:resourcekey="Page" %>

<%@ PreviousPageType VirtualPath="~/Inventory/MovementQuery.aspx" %>
<%@ Register Src="../UserControls/Pager.ascx" TagName="Pager" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>MovementList</title>
    <link href="../style/zh/1/css.css" type="text/css" rel="Stylesheet" id="mycss" />
    <link href="../Css/style.css" type="text/css" rel="stylesheet" />

    <script src="../Js/jquery.js" type="text/javascript"></script>

    <script src="../Js/jquery.simplemodal.js" type="text/javascript"></script>

    <script src="../Js/jquery.blockUI.js" type="text/javascript"></script>

    <script src="../Js/util.js" id="js" type="text/javascript"></script>

    <script src="../Js/InitPage.js" type="text/javascript"></script>

    <script src="../Js/Verification.js" type="text/javascript"></script>

    <script src="../Js/checkbox.js" type="text/javascript"></script>

    <script type="text/javascript">
        //初始化页面
        window.onload = function(){
            initListPage();
        }
        
        function returnSearch()
        {
            var from = document.getElementById("hdnFrom").value;
            if(from != "")
            {
                window.location.href = "MovementQuery.aspx";
            }
            else
            {
                window.history.go(-1);
            }
        }
        
        //弹出窗口选择货位
        function selectLocation(obj) {
            var rtnValue = popModalWindow('../Configuration/LocationQuery.aspx?action=' + escape(obj.id.toString()), 'dialogWidth=800px;dialogHeight=500px;center=yes;resizable=yes;status=no;');
            if(rtnValue != null && rtnValue.toString() != "")
            {
                document.getElementById(obj.id.toString()).focus();
                document.getElementById(obj.id.toString()).value = rtnValue;
            }
        }
        
        //弹出窗口选择LPN
        function selectLpn(obj) {
            var rtnValue = popModalWindow('../Inventory/LpnQuery.aspx?action=' + escape(obj.id.toString()), 'dialogWidth=800px;dialogHeight=500px;center=yes;resizable=yes;status=no;');
            if(rtnValue != null && rtnValue.toString() != "")
            {
                document.getElementById(obj.id.toString()).focus();
                document.getElementById(obj.id.toString()).value = rtnValue;
            }
        }
        
        //弹出窗口选择包装
        function selectPack(obj,rowIndex)
        {
            document.getElementById("hdnRowIndex").value = rowIndex;
            var rtnValue = popModalWindow('../Configuration/PackQuery.aspx?action=' + escape(obj.id.toString()), 'dialogWidth=800px;dialogHeight=500px;center=yes;resizable=yes;status=no;');
            if(rtnValue != null && rtnValue.toString() != "")
            {
                document.getElementById(obj.id.toString()).focus();
                document.getElementById(obj.id.toString()).value = rtnValue;
                __doPostBack("txtPackID_TextChanged","");
            }
        }
        
        //当包装代码文本框失去焦点的时候 给隐藏的RowIndex赋值
        function setPackIDRowIndex(rowIndex)
        {
            document.getElementById("hdnRowIndex").value = rowIndex;
        }
        
        //检查用户输入数量是否合法 只能是整数、0<移动数量<=可用数量
        function checkUserQtyData(availableQty,inputQty)
        {
            if(dataVer._Is123OrX(inputQty,'lblMsg'))
            {
                document.getElementById("lblMsg").style.display = "none";
                document.getElementById("lblMsg").innerText = "";
                if(parseFloat(inputQty.value) <= 0)
                {
                    document.getElementById("lblMsg").style.display = "block";
                    document.getElementById("lblMsg").innerText = "请输入大于0的移动数量!";
                    inputQty.innerText = "";
                    inputQty.focus();
                    return false;
                }
                else if(parseFloat(inputQty.value) > parseFloat(availableQty))
                {
                    document.getElementById("lblMsg").style.display = "block";
                    document.getElementById("lblMsg").innerText = "请输入小于可用数量的移动数量!";
                    inputQty.innerText = "";
                    inputQty.focus();
                    return false;
                }
            }
        }
        
        //锁屏
		function blockScreen()
		{
		    //锁屏
		    $.blockUI.defaults.message = GetBlockUIMsg();
            $.blockUI.defaults.overlayCSS.backgroundColor = GetBlockUIBgColor();
            $.blockUI();
		}
    </script>

</head>
<body>
    <form id="F5212" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div id="div_List_top">
            <table>
                <tr>
                    <td valign="bottom">
                        <asp:Label ID="lblMovement" runat="server" CssClass="label_header" Text="库存移动" meta:resourcekey="lblMovement"></asp:Label>
                    </td>
                    <td>
                        <asp:Button ID="btnMove" runat="server" CssClass="button" Text="<%$Resources:ButtonResource,btnMove%>"
                            OnClientClick="blockScreen();" OnClick="btnMove_Click" Enabled="False" />
                    </td>
                    <td>
                        <asp:Button ID="btnRefresh" runat="server" CssClass="button" Text="<%$Resources:ButtonResource,btnRefresh%>"
                            OnClick="btnRefresh_Click" Enabled="False" />
                    </td>
                </tr>
            </table>
        </div>
        <div class="blank8">
        </div>
        <asp:UpdatePanel ID="up1" runat="server">
            <ContentTemplate>
                <div id="div_List">
                    <div id="div_List_msg">
                        <asp:Label ID="lblMsg" runat="server" CssClass="label_message"></asp:Label>
                    </div>
                    <asp:GridView ID="gvMovement" runat="server" AutoGenerateColumns="False" CssClass="gridview" AllowSorting="false"
                        PageSize="20" OnRowDataBound="gvMovement_RowDataBound" Width="3900px" OnInit="gvMovement_Init" OnSorting="gvMovement_Sorting" 
                        DataKeyNames="LOT,LOC,LPN_ID,OWNER_ID,SKU_ID,AVAILABLE_QTY,HOLD_STATUS" meta:resourcekey="gvMovement">
                        <FooterStyle CssClass="GridViewFooterStyle" />
                        <RowStyle CssClass="GridViewRowStyle" />
                        <HeaderStyle CssClass="GridViewHeaderStyle" />
                        <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
                        <Columns>
                            <asp:BoundField HeaderText="序号" FooterText="序号" meta:resourcekey="BoundField">
                                <ItemStyle CssClass="GridViewRowWidth_40" />
                            </asp:BoundField>
                            <asp:TemplateField meta:resourcekey="TemplateField">
                                <HeaderTemplate>
                                  <img src="../Images/gvSettingpic.gif" id="img01" class="gvSettingImg" onclick="gvUserSetting('5212','gvMovement');" onmouseover="showGVUserSettingAlt(this);" alt="customize list" />
                                 
                                    <asp:CheckBox ID="CheckBox1" runat="server" onclick="selectAll(this,'gvMovement');"
                                        meta:resourcekey="CheckBox1" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="chbSelect" runat="server" meta:resourcekey="chbSelect" />
                                </ItemTemplate>
                                <FooterTemplate>
                                       
                                    <asp:CheckBox ID="CheckBox2" runat="server" onclick="selectAll(this,'gvMovement');"
                                        meta:resourcekey="CheckBox2" />
                                </FooterTemplate>
                                <HeaderStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_40" />
                                <ItemStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_40" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="OWNER_ID" HeaderText="货主代码" FooterText="货主代码" SortExpression="A.OWNER_ID"
                                meta:resourcekey="OWNER_ID">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="SKU_ID" HeaderText="货品代码" FooterText="货品代码" SortExpression="A.SKU_ID"
                                meta:resourcekey="SKU_ID">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOC" HeaderText="货位" FooterText="货位" SortExpression="A.LOC"
                                meta:resourcekey="LOC">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT" HeaderText="批次号" FooterText="批次号" SortExpression="A.LOT"
                                meta:resourcekey="LOT">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LPN_ID" HeaderText="LPN" FooterText="LPN" SortExpression="A.LPN_ID"
                                meta:resourcekey="LPN_ID">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:TemplateField FooterText="数量" HeaderText="数量" SortExpression="A.QTY" meta:resourcekey="QTY">
                                <ItemTemplate>
                                    <asp:Label ID="lblQTY" runat="server" Text='<%# GetPreferenceDigit(Eval("QTY").ToString()) %>'
                                        meta:resourcekey="lblQTY"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:TemplateField>
                            <asp:TemplateField FooterText="可用数量" HeaderText="可用数量" SortExpression="A.AVAILABLE_QTY"
                                meta:resourcekey="AVAILABLE_QTY">
                                <ItemTemplate>
                                    <asp:Label ID="lblAVAILABLE_QTY" runat="server" Text='<%# GetPreferenceDigit(Eval("AVAILABLE_QTY").ToString()) %>'
                                        meta:resourcekey="lblAVAILABLE_QTY"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="至LPN" FooterText="至LPN" meta:resourcekey="ToLpn">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtToLpn" CssClass="textbox" runat="server" Width="120px"  Text='<%# Eval("LPN_ID") %>' ></asp:TextBox>
                                    <asp:Image ID="imgSelectLpn" ImageUrl="../Images/icon_find.gif" CssClass="img" runat="server"
                                        meta:resourcekey="imgSelectLpn" />
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                                <ItemStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="至货位*" FooterText="至货位" meta:resourcekey="ToLoc">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtToLoc" CssClass="textbox" runat="server" Width="120px" meta:resourcekey="txtToLoc"></asp:TextBox>
                                    <asp:Image ID="imgSelectLocation" ImageUrl="../Images/icon_find.gif" CssClass="img"
                                        runat="server" meta:resourcekey="imgSelectLocation" />
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                                <ItemStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="移动数量*" FooterText="移动数量" meta:resourcekey="MoveQty">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtMoveQty" CssClass="textbox" runat="server" Width="120px" Text='<%# GetPreferenceDigit(Eval("AVAILABLE_QTY").ToString()) %>'></asp:TextBox>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                                <ItemStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="包装代码" FooterText="包装代码" meta:resourcekey="PackID">
                                <ItemTemplate>
                                    <asp:TextBox ID="txtPackID" CssClass="textbox" runat="server" Width="120px" AutoPostBack="True"
                                        OnTextChanged="txtPackID_TextChanged" meta:resourcekey="txtPackID"></asp:TextBox>
                                    <asp:Image ID="imgSelectPack" ImageUrl="../Images/icon_find.gif" CssClass="img" runat="server"
                                        meta:resourcekey="imgSelectPack" />
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                                <ItemStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="单位" FooterText="单位" meta:resourcekey="UomID">
                                <ItemTemplate>
                                    <asp:DropDownList ID="ddlUomID" CssClass="selectbox" runat="server" meta:resourcekey="ddlUomID">
                                    </asp:DropDownList>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                                <ItemStyle HorizontalAlign="Center" CssClass="GridViewRowWidth_150" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="PACK_ID" HeaderText="包装代码" FooterText="包装代码" SortExpression="C.PACK_ID"
                                meta:resourcekey="PACK_ID">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:TemplateField FooterText="货品描述" HeaderText="货品描述" SortExpression="DESCR" meta:resourcekey="DESCR">
                                <ItemTemplate>
                                    <asp:Label ID="lblSkuDescr" runat="server" Text='<%# Eval("DESCR").ToString() %>'
                                        meta:resourcekey="lblSkuDescr"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="GridViewRowWidth_200" Width="199px" />
                            </asp:TemplateField>
                            <asp:TemplateField FooterText="分配数量" HeaderText="分配数量" SortExpression="A.ALLOCATED_QTY"
                                meta:resourcekey="ALLOCATED_QTY">
                                <ItemTemplate>
                                    <asp:Label ID="lblALLOCATED_QTY" runat="server" Text='<%# GetPreferenceDigit(Eval("ALLOCATED_QTY").ToString()) %>'
                                        meta:resourcekey="lblALLOCATED_QTY"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="HOLD_STATUS" HeaderText="状态" FooterText="状态" SortExpression="HOLD_STATUS"
                                meta:resourcekey="HOLD_STATUS">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="EXTERNAL_LOT" HeaderText="外部批号" FooterText="外部批号" SortExpression="EXTERNAL_LOT" meta:resourcekey="EXTERNAL_LOT">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="VENDOR_ID" HeaderText="供应商代码" FooterText="供应商代码" SortExpression="VENDOR_ID" meta:resourcekey="VENDOR_ID">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:TemplateField FooterText="生产日期" HeaderText="生产日期" SortExpression="PRODUCE_DATE" meta:resourcekey="PRODUCE_DATE">
                                <ItemTemplate>
                                    <asp:Label ID="lblPRODUCE_DATE" runat="server" Text='<%# GetPreferenceShortDate(Eval("PRODUCE_DATE").ToString()) %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="GridViewRowWidth_150" />
                            </asp:TemplateField>
                            <asp:TemplateField FooterText="失效日期" HeaderText="失效日期" SortExpression="EXPIRY_DATE"
                                meta:resourcekey="EXPIRY_DATE">
                                <ItemTemplate>
                                    <asp:Label ID="lblEXPIRY_DATE" runat="server" Text='<%# GetPreferenceShortDate(Eval("EXPIRY_DATE").ToString()) %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle CssClass="GridViewRowWidth_150" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="SKU_PROPERTY" HeaderText="货品属性" FooterText="货品属性" SortExpression="SKU_PROPERTY" 
                                meta:resourcekey="SKU_PROPERTY">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT_ATTR01" HeaderText="批属性01" FooterText="批属性01" SortExpression="LOT_ATTR01" 
                                meta:resourcekey="LOT_ATTR01">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT_ATTR02" HeaderText="批属性02" FooterText="批属性02" SortExpression="LOT_ATTR01" 
                                meta:resourcekey="LOT_ATTR02">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT_ATTR03" HeaderText="批属性03" FooterText="批属性03" SortExpression="LOT_ATTR03" 
                                meta:resourcekey="LOT_ATTR03">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT_ATTR04" HeaderText="批属性04" FooterText="批属性04" SortExpression="LOT_ATTR04" 
                                meta:resourcekey="LOT_ATTR04">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT_ATTR05" HeaderText="批属性05" FooterText="批属性05" SortExpression="LOT_ATTR05" 
                                meta:resourcekey="LOT_ATTR05">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT_ATTR06" HeaderText="批属性06" FooterText="批属性06" SortExpression="LOT_ATTR06" 
                                meta:resourcekey="LOT_ATTR06">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT_ATTR07" HeaderText="批属性07" FooterText="批属性07" SortExpression="LOT_ATTR07" 
                                meta:resourcekey="LOT_ATTR07">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT_ATTR08" HeaderText="批属性08" FooterText="批属性08" SortExpression="LOT_ATTR08" 
                                meta:resourcekey="LOT_ATTR08">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                            <asp:BoundField DataField="LOT_ATTR10" HeaderText="批属性10" FooterText="批属性10" SortExpression="LOT_ATTR10" 
                                meta:resourcekey="LOT_ATTR10">
                                <ItemStyle CssClass="GridViewRowWidth_100" />
                            </asp:BoundField>
                        </Columns>
                    </asp:GridView>
                </div>
                <div id="div_pager">
                    <uc1:Pager ID="PagerFooter" runat="server" OnFirst="btnFirst_Click" OnPrevious="btnPrevious_Click"
                        OnNext="btnNext_Click" OnLast="btnLast_Click" OnGoTo="GoTo_Click" />
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnList" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
        <div id="div_List_bottom">
            <table>
                <tr>
                    <td>
                        <asp:Button ID="btnNewSearch" runat="server" Text="<%$Resources:ButtonResource,btnNewSearch%>"
                            CssClass="button" Enabled="False" OnClientClick="javascript:window.location.href='MovementQuery.aspx';return false;" />
                    </td>
                    <td>
                        <asp:Button ID="btnReSearch" runat="server" Text="<%$Resources:ButtonResource,btnReSearch%>"
                            CssClass="button" Enabled="False" OnClientClick="javascript:returnSearch();return false;" />
                    </td>
                    <td>
                        <asp:Button ID="btnList" runat="server" Text="<%$Resources:ButtonResource,btnList%>"
                            CssClass="button " Enabled="False" />
                    </td>
                    <td>
                        <asp:Button ID="btnExport" runat="server" Text="<%$Resources:ButtonResource,btnExport%>"
                            CssClass="button" Enabled="False" OnClick="btnExport_Click" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <input type="hidden" id="hdnRowIndex" runat="server" />
    <input type="hidden" id="hdnFrom" runat="server" />
    <input type="hidden" id="hdnActionID" runat="server" />
    </form>
</body>
</html>
